package com.ahp.config;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public enum PriorityType {
	CATEGORY("CATEGORY", "CATEGORY"),
	// CATEGORY
	COST("COST", "COST"), QUALITY("QUALITY", "QUALITY"), ORGANIZATION(
			"ORGANIZATION", "ORGANIZATION"), PRODUCT_DEVELOPMENT(
			"PRODUCT_DEVELOPMENT", "PRODUCT DEVELOPMENT"), DELIVERY("DELIVERY",
			"DELIVERY"), COMMERCIAL_TEAM("COMMERCIAL_TEAM", "COMMERCIAL TEAM"),
	// COST
	COST_REDUCTION_PLAN("COST_REDUCTION_PLAN", "COST REDUCTION PLAN"), INITIAL_PRICE_QOUTE(
			"INITIAL_PRICE_QOUTE", "INITIAL PRICE QOUTE"),
	// ORGANIZATION
	FINANCIAL_STABILITY("FINANCIAL_STABILITY", "FINANCIAL STABILITY"), CLIENTELE_PATRONAGE(
			"CLIENTELE_PATRONAGE", "CLIENTELE / PATRONAGE"), BUSINESS_VOLUME(
			"BUSINESS_VOLUME", "BUSINESS VOLUME"), TECHNOLOGY_AND_INNOVATION(
			"TECHNOLOGY_AND_INNOVATION", "TECHNOLOGY AND INNOVATION"),
	// PRODUCT DEVELOPMENT
	DESIGN_INTERPRETATION("DESIGN_INTERPRETATION", "DESIGN INTERPRETATION"), CONTENT_QUALITY(
			"CONTENT_QUALITY", "CONTENT QUALITY"), PD_LEAD_TIME("PD_LEAD_TIME",
			"PD_LEAD_TIME"),
	// DELIVERY
	DELIVERY_LEAD_TIME("DELIVERY_LEAD_TIME", "DELIVERY_LEAD_TIME"), VARIABILITY_OF_LEAD_TIME(
			"VARIABILITY_OF_LEAD_TIME", "VARIABILITY OF LEAD TIME"), FLEXIBILITY(
			"FLEXIBILITY", "FLEXIBILITY"),
	// COMMERCIAL TEAM
	COMMUNICATION_RESPONSE_TIME("COMMUNICATION_RESPONSE_TIME",
			"COMMUNICATION / RESPONSE TIME"), PRODUCTION_FOLLOW_UP(
			"PRODUCTION_FOLLOW_UP", "PRODUCTION FOLLOW-UP"),
	// FLEXIBILITY
	DESIGN_CHANGE_FLEXIBILITY("DESIGN_CHANGE_FLEXIBILITY",
			"DESIGN CHANGE FLEXIBILITY"), CAPACITY_FLEXIBILITY(
			"CAPACITY_FLEXIBILITY", "CAPACITY FLEXIBILITY"), TECHNICAL_PROBLEM_SOLVING(
			"TECHNICAL_PROBLEM_SOLVING", "TECHNICAL PROBLEM SOLVING"),
	// TECHNOLOGY AND INNOVATION
	INFORMATION_INFRASTRUCTURE("INFORMATION_INFRASTRUCTURE",
			"INFORMATION INFRASTRUCTURE"), TECHNOLOGICAL_INNOVATION(
			"TECHNOLOGICAL_INNOVATION", "TECHNOLOGICAL INNOVATION");

	private String label;
	private String name;

	public String getLabel() {
		return label;
	}

	public String getName() {
		return name;
	}

	PriorityType(String name, String label) {
		this.name = name;
		this.label = label;
	}

	public String[] getCriteriaLabels() {
		List<String> criteriaLabels = new ArrayList<String>();
		for (PriorityType priorityType : getCriteriaList()) {
			criteriaLabels.add(new String(priorityType.getLabel()));
		}
		String[] criteriaLabs = new String[criteriaLabels.size()];
		for (int i = 0; i < criteriaLabels.size(); i++) {
			criteriaLabs[i] = criteriaLabels.get(i);
		}
		return criteriaLabs;
	}

	public String[] getCriteriaNames() {
		List<String> criteriaNames = new ArrayList<String>();
		for (PriorityType priorityType : getCriteriaList()) {
			criteriaNames.add("" + priorityType.getName());
		}
		String[] criteriaLabs = new String[criteriaNames.size()];
		for (int i = 0; i < criteriaNames.size(); i++) {
			criteriaLabs[i] = criteriaNames.get(i);

		}
		return criteriaLabs;
	}

	public List<PriorityType> getCriteriaList() {
		switch (this) {
		case CATEGORY:
			return Arrays.asList(COST, QUALITY, DELIVERY, ORGANIZATION,
					PRODUCT_DEVELOPMENT, COMMERCIAL_TEAM);
		case COST:
			return Arrays.asList(COST_REDUCTION_PLAN, INITIAL_PRICE_QOUTE);
		case ORGANIZATION:
			return Arrays.asList(FINANCIAL_STABILITY, CLIENTELE_PATRONAGE,
					BUSINESS_VOLUME, TECHNOLOGY_AND_INNOVATION);
		case PRODUCT_DEVELOPMENT:
			return Arrays.asList(DESIGN_INTERPRETATION, CONTENT_QUALITY,
					PD_LEAD_TIME);
		case DELIVERY:
			return Arrays.asList(DELIVERY_LEAD_TIME, VARIABILITY_OF_LEAD_TIME,
					FLEXIBILITY);
		case COMMERCIAL_TEAM:
			return Arrays.asList(COMMUNICATION_RESPONSE_TIME,
					PRODUCTION_FOLLOW_UP);
		case FLEXIBILITY:
			return Arrays.asList(DESIGN_CHANGE_FLEXIBILITY,
					CAPACITY_FLEXIBILITY, TECHNICAL_PROBLEM_SOLVING);
		case TECHNOLOGY_AND_INNOVATION:
			return Arrays.asList(INFORMATION_INFRASTRUCTURE,
					TECHNOLOGICAL_INNOVATION);
		default:
			return new ArrayList<PriorityType>();
		}
	}
}
